home *** CD-ROM | disk | FTP | other *** search
- _PRINTING FROM WINDOWS 3_
- by Michael J. Young
-
- [Example 1]
-
- BOOL FAR PASCAL AbortProc (HDC HPrnDC,short Code)
- {
- MSG Msg;
-
- while (!UserAbort && PeekMessage (&Msg,NULL,0,0,PM_REMOVE))
- {
- TranslateMessage (&Msg);
- DispatchMessage (&Msg);
- }
- return (!UserAbort);
-
- } // end AbortProc
-
-
- [Example 2]
-
- HWND HAbortButton;
- HANDLE HInst;
- HDC HPrnDC;
- BOOL InPrintJob = FALSE;
- FARPROC PtrAbortProc;
- BOOL UserAbort;
- .
- .
- .
- if (InPrintJob)
- return (NULL);
- HPrnDC = GetPrnDC ();
- ShowWindow (HAbortButton,SW_SHOW);
- UserAbort = FALSE;
- InPrintJob = TRUE;
- PtrAbortProc = MakeProcInstance (AbortProc,HInst);
- Escape (HPrnDC,SETABORTPROC,0,(LPSTR)PtrAbortProc,NULL);
- Escape (HPrnDC,STARTDOC,10,(LPSTR)"Print Demo",0L);
-
- // Calls to GDI output functions, such as TextOut and Ellipse go here.
- Escape (HPrnDC,NEWFRAME,0,0L,0L);
- Escape (HPrnDC,ENDDOC,0,0L,0L);
- FreeProcInstance (PtrAbortProc);
- InPrintJob = FALSE;
- ShowWindow (HAbortButton,SW_HIDE);
- DeleteDC (HPrnDC);
-